﻿CREATE TABLE [dbo].[InventoryItem] (
    [Id]                    UNIQUEIDENTIFIER NOT NULL,
    [ItemId]                UNIQUEIDENTIFIER NULL,
    [PurchaserProjectId]    UNIQUEIDENTIFIER NOT NULL,
    [CurrentProjectId]      UNIQUEIDENTIFIER NOT NULL,
    [VoucherNumber]         NVARCHAR (100)   NULL,
    [Description]           NTEXT            NULL,
    [AssetType]             NVARCHAR (100)   NULL,
    [AssetModel]            NVARCHAR (100)   NULL,
    [IsinSubOffice]         BIT              NULL,
    [CountrySubOfficeId]    UNIQUEIDENTIFIER NULL,
    [IsinWareHouse]         BIT              NULL,
    [IsinOtherLocation]     BIT              NULL,
    [LocationId]            UNIQUEIDENTIFIER NULL,
    [WareHouseId]           UNIQUEIDENTIFIER NULL,
    [AcquisitionCost]       MONEY            NULL,
    [AcquisitionCurrencyId] UNIQUEIDENTIFIER NULL,
    [AcquisitionDate]       DATE             NULL,
    [Lifespan]              INT              NULL,
    [SalvageValue]          MONEY            NULL,
    [MonthlyDepreciation]   MONEY            NOT NULL,
    [DepreciationMonths]    INT              NULL,
    [DepreciationCost]      MONEY            NULL,
    [NetBookValue]          MONEY            NULL,
    [AvailableQuantity]     INT              NULL,
    [UnitOfMeasureId]       UNIQUEIDENTIFIER NULL,
    [SuppliedThroughPO]     BIT              NULL,
    [POId]                  UNIQUEIDENTIFIER NULL,
    [SupplierId]            UNIQUEIDENTIFIER NULL,
    [AssetNumber]           NVARCHAR (50)    NULL,
    [ConsumableId]          UNIQUEIDENTIFIER NULL
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Project that purchased the asset', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'PurchaserProjectId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Project currently owning the asset', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'CurrentProjectId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Receipt number', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'VoucherNumber';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Item description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'Description';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Estimated useful life in years', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'Lifespan';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Estimated salvage value in Danish Currencies', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'SalvageValue';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Estimated straight-line depreciation value per month', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'MonthlyDepreciation';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Depreciation period in months', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'DepreciationMonths';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'In Danish Currency', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'DepreciationCost';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'In Danish Currency', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'InventoryItem', @level2type = N'COLUMN', @level2name = N'NetBookValue';

